<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta name="viewport" content="width=device-width,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no" />
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <meta name="format-detection" content="telephone=no" />
    <title>项目详情</title>
    <link rel="stylesheet" href="../../css/reset.css" />
    <style>
        body {
            width: 100%;
            background-color: #f6f6f6;
            font-size: 0.26rem;
            padding-top: 0.5rem;
            height: auto;
            -webkit-tap-highlight-color: rgba(0, 0, 0, 0);
            font-family: PingFang SC;
            color: #333333;
            padding-bottom: 1.3rem;
        }

        .testFix {
            width: 100%;
            height: 1rem;
            position: fixed;
            top: 0;
            left: 0;
            background: url("../../image/bgfirst.png") no-repeat center;
            background-size: 100% 100%;
            z-index: 100;
        }

        .head {
            width: 100%;
            height: 47px;
            display: flex;
            display: -webkit-flex;
            justify-content: space-between;
            -webkit-justify-content: space-between;
            align-items: center;
            -webkit-align-items: center;
            box-sizing: border-box;
            padding: 0 0.26rem;
        }

        .head img {
            width: 0.21rem;
            height: 0.36rem;
        }

        .head_title {
            font-size: 0.32rem;
            color: #333333;
            -webkit-tap-highlight-color: rgba(0, 0, 0, 0);
        }

        .showimg {
            width: 100%;
            height: 4.22rem;
        }

        .showimg img {
            width: 100%;
            height: 4.22rem;
        }

        .showItemheader {
            width: 100%;
            height: 3.56rem;
            background: url("../../image/bgg.png") no-repeat center;
            background-size: cover;
            margin-top: 3%;
            padding: 0 0.3rem;
            display: flex;
            display: -webkit-flex;
            flex-direction: column;
            align-items: flex-start;
            justify-content: space-between;
            box-sizing: border-box;
        }

        .showItemheader>p {
            width: 100%;
            height: auto;
            display: flex;
            display: -webkit-flex;
            align-items: center;
            justify-content: flex-start;
            padding-top: 0.5rem;
            box-sizing: border-box;
        }

        .showItemheader>p>span {
            font-size: 0.32rem;
            font-family: PingFang SC;
            font-weight: bold;
            color: rgba(38, 38, 38, 1);
            margin-left: 0.15rem;
        }

        .showItemheader>div {
            width: 100%;
            height: 2.4rem;
            background: rgba(254, 255, 255, 1);
            box-shadow: 0px 0.14rem 0.35rem 0px rgba(224, 224, 224, 0.1);
            border-radius: 0.06rem;
        }

        .showItemheader>div ul {
            width: 100%;
            height: 100%;
            display: flex;
            display: -webkit-flex;
            flex-direction: column;
            align-items: center;
            justify-content: flex-start;
        }

        .showItemheader>div ul li {
            width: 100%;
            height: auto;
            display: flex;
            display: -webkit-flex;
            align-items: flex-start;
            justify-content: space-between;
            padding: 0 0.3rem;
            box-sizing: border-box;
        }

        .showItemheader>div ul li:first-of-type {
            justify-content: flex-start;
            align-items: flex-end;
            margin-top: 0.24rem;
            margin-bottom: 0.12rem;
        }

        .bandDays {
            width: 1.57rem;
            height: .34rem;
            background: rgba(251, 246, 218, 1);
            opacity: 0.76;
            border-radius: 0.04rem;
            font-size: 0.22rem;
            font-family: PingFang SC;
            font-weight: 500;
            color: rgba(199, 148, 76, 1);
            line-height: 0.34rem;
            text-align: center;
        }

        .showItemheader>div ul li:first-of-type span {
            font-size: 0.3rem;
            color: #262626;
        }

        .showItemheader>div ul li:first-of-type .samllText {
            font-size: 0.18rem;
            padding-top: 0.16rem;
            box-sizing: border-box;
            margin-left: 0.1rem;
        }

        .showItemheader>div ul li:nth-of-type(3) p,
        .showItemheader>div ul li:last-of-type p {
            width: 40%;
        }

        .showItemheader>div ul li:nth-of-type(3) p:last-of-type,
        .showItemheader>div ul li:last-of-type p:last-of-type {
            flex: 1;
            padding-left: 0.2rem;
            box-sizing: border-box;
        }

        .showItemheader>div ul li:last-of-type p,
        .showItemheader>div ul li:last-of-type span {
            display: flex;
            display: -webkit-flex;
            align-items: center;
            justify-content: space-between;
            color: #595959;
        }

        .triangleClass {
            display: inline-block;
            position: absolute;
            left: 42%;
            bottom: -0.05rem;
            width: 0;
            height: 0;
            border-top: 0.1rem solid rgba(255, 218, 52, 1);
            border-right: 0.1rem solid transparent;
            border-left: 0.1rem solid transparent;
            z-index: 2;
        }

        .showItemheader>div ul li:nth-of-type(3) p,
        .showItemheader>div ul li:nth-of-type(3) span {
            display: flex;
            display: -webkit-flex;
            align-items: center;
            justify-content: space-between;
            color: #595959;
        }

        .showItemheader>div ul li:nth-of-type(3) {
            margin-top: 0.1rem;
            color: rgba(48, 20, 5, 1);
            font-size: 0.24rem;
        }

        .showItemheader>div ul li:nth-of-type(3) p span:last-of-type {
            margin-left: 0.1rem;
            color: #181818;
        }

        .showItemheader>div ul li:last-of-type {
            margin-top: 0.15rem;
            color: rgba(48, 20, 5, 1);
            font-size: 0.24rem;
        }

        .showItemheader>div ul li:last-of-type p span:last-of-type {
            margin-left: 0.1rem;
            color: #181818;
        }

        .showAboutMachine {
            width: 100%;
            height: auto;
            display: flex;
            display: -webkit-flex;
            flex-direction: column;
            align-items: flex-start;
            justify-content: center;
            box-sizing: border-box;
            padding: 0 0.3rem;
        }

        .showtextdetail {
            width: 100%;
            height: auto;
            display: flex;
            display: -webkit-flex;
            flex-direction: column;
            align-items: flex-start;
            justify-content: center;
            background-color: #fff;
            box-shadow: 0 0.14rem 0.35rem 0 rgba(224, 224, 224, 0.1);
            border-radius: 0.1rem;
            margin-top: 0.2rem;
            box-sizing: border-box;
        }

        .showtextdetail p {
            width: 100%;
            height: auto;
            display: flex;
            display: -webkit-flex;
            align-items: center;
            justify-content: space-between;
            background-color: #fff;
            padding: 0 0.28rem;
            box-sizing: border-box;
            font-size: 0.28rem;
            color: #262626;
            margin-bottom: 0.1rem;
            font-weight: 500;
        }

        .showtextdetail p:last-of-type {
            margin-bottom: .22rem;
        }

        .showtextdetail p span:first-of-type {
            color: #999999;
        }

        .showbasePower {
            width: 100%;
            height: 0.9rem;
            display: flex;
            display: -webkit-flex;
            align-items: center;
            justify-content: space-between;
            background-color: #fff;
            padding: 0 0.26rem;
            box-sizing: border-box;
            margin-top: 0.2rem;
            border-radius: 6px;
            font-weight: 500;
        }

        .showbasePower span:first-of-type {
            color: #999999;
        }

        .machineDetail {
            width: 100%;
            height: auto;
            margin-top: 0.1rem;
            border-radius: 6px;
        }

        .machineDetail ul {
            width: 100%;
            height: auto;
            padding: 0 0.26rem;
            display: flex;
            display: -webkit-flex;
            flex-direction: column;
            align-items: flex-start;
            justify-content: center;
            background-color: #fff;
            box-sizing: border-box;
        }

        .machineDetail ul li {
            width: 100%;
            height: auto;
            display: flex;
            display: -webkit-flex;
            flex-direction: column;
            align-items: flex-start;
            justify-content: center;
            margin-top: 0.43rem;
            box-sizing: border-box;
        }

        .machineDetail ul li:first-of-type {
            margin-top: 0.3rem;
        }

        .machineDetail ul li:last-of-type {
            margin-bottom: 0.43rem;
        }

        .machineDetail ul li b {
            display: block;
            width: 100%;
            height: 0.4rem;
            font-size: 0.3rem;
            position: relative;
            margin-bottom: 0.3rem;
        }

        .machineDetail ul li p {
            font-size: 0.26rem;
            font-family: PingFang SC;
            font-weight: 500;
            color: rgba(89, 89, 89, 1);
            line-height: 0.48rem;
        }

        .machineDetail ul li b>span {
            position: absolute;
            width: 1.3rem;
            height: 100%;
            left: 0;
            top: 0;
            z-index: 1;
            text-align: center;
        }

        .machineDetail ul li b>i {
            font-size: 0.3rem;
            position: absolute;
            width: 1.3rem;
            height: 0.1rem;
            content: " ";
            left: 0;
            bottom: 0;
            background-color: #FFD203;
            opacity: 0.5;
            z-index: 0;
        }

        .showButton {
            width: 100%;
            height: auto;
            display: flex;
            display: -webkit-flex;
            align-items: center;
            justify-content: center;
            margin-top: 0.23rem;
            position: fixed;
            bottom: 0.2rem;
            left: 0;
            z-index: 50;
        }

        .showButton button {
            width: 6.54rem;
            height: 0.8rem;
            outline: none;
            border: none;
            background: rgba(255, 217, 64, 1);
            border-radius: 0.1rem;
            text-align: center;
            line-height: 0.8rem;
            font-size: 0.3rem;
            font-family: PingFang SC;
            font-weight: 500;
            color: rgba(38, 38, 38, 1);
        }

        .back {
            background-color: #f1f1f1;
            border-radius: 0 0 0 0.1rem;
        }

        #machineHtml img {
            max-width: 100%;
        }
    </style>
</head>

<body>
    <div class="testFix">
        <div class="head" style="position: relative">
            <span id="goback"
                style="position: absolute;z-index: 1;left: 0;padding: 0 0.3rem; padding-right: 0.5rem;top: 0;height: 100%; box-sizing: border-box;line-height: 47px;">
                <img src="../../image/left_jiantouax.png" alt="" style="width: 10px;height: auto" />
            </span>
            <span class="head_title" style="display: block;width: 100%;text-align: center">
                合约包详情
            </span>
            <span style="display: inline-block;width: 0.21rem;height: 0.36rem;">
            </span>
        </div>
    </div>
    <div class="showItemheader">
        <p>
            <img src="../../image/iconbsasx.png" id="imgSrcchange"
                style="width: 0.67rem;height: 0.3rem;border-radius:0.08rem;">
            <span class="name_th">
                BTC 单币算力包
            </span>
        </p>
        <div>
            <ul>
                <li>
                    <span style="font-weight: normal;color:#595959;font-size:0.24rem;">
                        单份价格
                    </span>
                    <span class="deposit" style="margin-left: 0.1rem;">0</span>
                    <span class="moneyType samllText">CNY</span>
                    <span class="samllText hideother" style="display: none;">&nbsp;/&nbsp;&nbsp;</span>
                    <span class="showUsdtNum hideother" style="display: none;">0</span>
                    <span class="samllText hideother" style="display: none;">USDT</span>
                </li>
                <li style="justify-content: flex-start;">
                    <!-- <span class="not_return"
                        style="background-color: #FCF5E2;color:#F19224;font-size: 0.2rem;display: inline-block;height: 0.34rem;padding: 0 0.15rem;line-height: 0.34rem;margin-right: 0.1rem;border-radius: 0.04rem;display: none;">
                        不可回购
                    </span> -->
                    <p class="bandDays">
                        锁定期
                        <span class="daylimit">
                            0天
                        </span>
                    </p>
                    <p class="fenQigou"
                        style="margin-left:0.1rem;background:rgba(255,242,239,1);border-radius:0.04rem;color:rgba(194,56,43,1);font-size: 0.22rem; padding: 0 0.1rem;display: none;">
                        分期购
                    </p>
                </li>
                <li>
                    <p>
                        <span>
                            最小下单限额
                        </span>
                        <span class="minRent">
                            0T
                        </span>
                    </p>
                    <p>
                        <span>
                            剩余算力
                        </span>
                        <span class="disnum">
                            0T
                        </span>
                    </p>
                </li>
                <li>
                    <p>
                        <span>
                            最大下单限额
                        </span>
                        <span class="maxRent">
                            0T
                        </span>
                    </p>
                    <p>
                        <span class="isshow" style="display:none;">
                            收益预估
                        </span>
                        <span class="expectedReturn isshow" style="color: #FF7C34;display:none;">
                            --
                        </span>
                    </p>
                </li>
            </ul>
        </div>
    </div>
    <div class="showAboutMachine">
        <div class="showtextdetail">
            <p class="bhpcshow" style="display: none;margin-top: 0.28rem;">
                <span>
                    下单资格
                </span>
                <span class="showlistnew" style="margin-left: 0.1rem;display: inline-block;height: auto;">
                    有效算龄大于等于1000T*天
                    <img src="../../image/mynumber.png" alt=""
                        style="width: 0.43rem;height: 0.43rem;margin-right: 0.1rem;" />
                </span>
            </p>
            <p class="showthisText">
                <span>
                    发币方式
                </span>
                <span>
                    每日结算，次日放至账户
                </span>
            </p>
            <p>
                <span>
                    分币比例
                </span>
                <span class="discreatRate" style="color: #F67311;">
                    0.00%
                </span>
            </p>
            <p>
                <span>
                    开挖日期
                </span>
                <span class="digtime">
                    0000-00-00 00:00:00
                </span>
            </p>
            <p>
                <span>
                    算力来源
                </span>
                <span class="calculateSource">
                </span>
            </p>
        </div>
        <div class="showbasePower">
            <span>
                基础算力
            </span>
            <span class="base">
            </span>
        </div>
        <div class="machineDetail" id="machineHtml">
        </div>
    </div>
    <div class="showButton">
        <button id="goRentPage" data-status="">
            立即下单
        </button>
    </div>
</body>

<script src="../../script/autosize.js"></script>
<script src="../../script/jquery_three_two_one.js"></script>
<script src="../../script/fastclick.js"></script>
<script src="../../script/app.js"></script>
<script>
    apiready = function () {
        var app = new APP();
        if (app.isiPhone10) {
            $(".phoneToast").height("30px");
            $("#fixBtn").css("padding-bottom", "30px");
            var bodyPa = Number($("#fixBtn").height()) + 10 + 30;
            $("body").css("padding-bottom", bodyPa + "px");
        }
        var account = app.getAccount();
        var machineId = api.pageParam.itemId;
        var machineTypeNew = api.pageParam.machineType;
        $("#goback").on("click", function () {
            api.closeWin();
        });
        function loadpage(machineId) {
            app.ajaxPro({
                url: "machine/get",
                values: {
                    token: account? account.token : "",
                    machine_id: machineId
                },
                openFlower: true
            }, function (ret) {
                if (ret.code == 200) {
                    var mechineAbout = ret.data;
                    console.log('mechineAbout+++++++++++++++++++++++++++++++++' + JSON.stringify(mechineAbout));
                    $(".machineDetail").html(mechineAbout.machine.desc);
                    if (mechineAbout.machine.type == 10) {
                        $(".not_return").show();
                    }
                    //判断单台算力单位
                    if (mechineAbout.machine.currency_code === "BTC") {
                        machineUnit = "TH/s";
                    } else if (
                        mechineAbout.machine.currency_code === "ETH" || mechineAbout.machine.currency_code === "LTC"
                    ) {
                        machineUnit = "MH/s";
                    }
                    if (mechineAbout.machine.is_installment == 1) {
                        $(".fenQigou").show();
                    }
                    $(".isshow").show();
                    $(".expectedReturn").text('约' + String(mechineAbout.machine.predict_income).replace(/([0-9]+\.[0-9]{0,2})[0-9]*/, "$1") + 'CNY/份');
                    $(".showlistnew").on("click", function () {
                        var param = {
                            dtype: "dialog48",
                            data: {
                                dataDays: (mechineAbout.my_td == 0 ? "0.00" : mechineAbout.my_td) + "T*天"
                            }
                        };
                        app.dialog(param);
                    });
                    var limitRentUnit = mechineAbout.machine.unit_name;
                    $(".discreatRate").text(app.accMul(mechineAbout.machine.distribution_rate, 100) + "%");
                    $(".base").text(
                        Number(mechineAbout.machine.base_power) + limitRentUnit + "/份"
                    );
                    //处理机器是否能租用
                    $("#goRentPage").text("立即下单").attr("data-status", "okrent");
                    //产品名称
                    $(".name_th").text(mechineAbout.machine.name);
                    //单台算力
                    $(".digtime").text(mechineAbout.machine.time_income);
                    $(".calculateSource").text(mechineAbout.machine.power_node_name);
                    $(".disnum").text(
                        app.accMul(mechineAbout.machine.base_power, mechineAbout.machine.productNum) + limitRentUnit
                    );
                    $(".maxRent").text(
                        app.accMul(mechineAbout.machine.base_power, (Number(mechineAbout.machine.batchLimitNum) < Number(mechineAbout.machine.maxLimitNum) ? mechineAbout.machine.batchLimitNum : mechineAbout.machine.maxLimitNum)) +
                        limitRentUnit
                    );
                    $(".minRent").text(
                        app.accMul(mechineAbout.machine.base_power, mechineAbout.machine.minLimitNum) + limitRentUnit
                    );
                    if (mechineAbout.machine.is_bhp_pos == 1) {
                        $(".bhpcshow").show();
                    } else {
                        $("#imgSrcchange").css({
                            "width": "0.3rem",
                            "height": "0.3rem"
                        })
                        if (mechineAbout.machine.currency_code == "BTC") {
                            $("#imgSrcchange").attr("src", "../../image/iconasxx.png");
                        } else if (mechineAbout.machine.currency_code == "ETH") {
                            $("#imgSrcchange").attr("src", "../../image/iconcethx.png");
                        } else {
                            $("#imgSrcchange").attr("src", "../../image/icondltcx.png");
                        }
                        $(".showthisText").css("marginTop", "0.28rem");
                    }
                    var depositPrice = mechineAbout.machine.good_deposit;
                    var payCnyNum = 0, payUsdtNum = 0;//支付金额
                    for (var i = 0; i < depositPrice.length; i++) {
                        if (String(depositPrice[i].goods_deposit).indexOf(".") != -1) {
                            if (depositPrice[i].goods_deposit.split(".")[1] * Math.pow(10, 4) < 1) {
                                depositPrice[i].goods_deposit = depositPrice[i].goods_deposit.split(".")[0]
                            }
                        }
                        if (depositPrice[i].pay_currency == "CNY") {
                            $(".deposit").text(
                                depositPrice[i].goods_deposit
                            );
                            payCnyNum = depositPrice[i].goods_deposit;
                        }
                        if (depositPrice[i].pay_currency == "USDT") {
                            $(".showUsdtNum").text(
                                depositPrice[i].goods_deposit
                            );
                            payUsdtNum = depositPrice[i].goods_deposit
                        }
                    }

                    //产品期限
                    $(".daylimit").text(
                        mechineAbout.machine.is_regular == 0 ? "30天" : mechineAbout.machine.regular_date_num + "天"
                    );
                    if (mechineAbout.machine.pay_channel.length > 1) {
                        $(".hideother").show();
                        $(".showUsdtNum").text(mechineAbout.machine.goods_deposit_usdt);
                    }
                    //处理租用事件
                    $("#goRentPage").on("click", function () {
                        if (app.ST == "ios") {
                            app.onEvent("count", "btcDetail");
                        } else {
                            app.onEvent("count", "btcDetailanzhuo");
                        }
                        if (!app.isLogin()) {
                            // 跳转登录页面
                            app.toast("该操作需要登录");
                            app.goLogin(true);
                            return;
                        }
                        var pageValue = {
                            name: "machine_newrent",
                            subpage: "rent/machine_newrent",
                            title: "详情",
                            param: {
                                pageName: "machine_newrent",
                                machineDeatail: mechineAbout.machine,//机器所有信息
                                payUsdtNum: payUsdtNum,//现金单价
                                payCnyNum: payCnyNum,//usdt单价
                                userAset: mechineAbout.asset,//用户资产,
                                pe_power: mechineAbout.pe_power
                            }
                        }
                        app.setNavBarAttr(pageValue);
                    });
                } else {
                    app.toast(ret.message);
                }
            })
        }
        loadpage(machineId);
        $(".showTextTips").click(function (e) {
            e.stopPropagation();
            $(".showAfter,.triangleClass").show();
        })
        $("body").click(function () {
            $(".showAfter,.triangleClass").hide();
        })
        app.listen("rent_successnews", function () {
            app.closeW();
        });
        app.listen("backFirstnew",function() {
            app.reload();
        })
    };
</script>

</html>